package com.example.Life_course.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.Life_course.entity.LifeCourseDO;
import com.example.Life_course.mapper.LifeCourseMapper;
import com.example.Life_course.service.LifeCourseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.common.PageUtils;
import com.example.raising_skills.entity.RaisingSkillsDO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author tc
 * @since 2022-12-08
 */
@Service
public class LifeCourseServiceImpl extends ServiceImpl<LifeCourseMapper, LifeCourseDO> implements LifeCourseService {

    @Override
    public PageUtils QueryLifeCourse(Integer pageNum, Integer pageSize, String search) {
        List<LifeCourseDO> list = baseMapper.selectList(null);
        Page<LifeCourseDO> page = baseMapper.selectPage(new Page<>(pageNum,pageSize), Wrappers.<LifeCourseDO>lambdaQuery().like(LifeCourseDO::getPeriod,search));
        int total =list.size();
        page.setTotal(total);
        return new PageUtils(page);
    }
}
